<div ng-controller="FreeController">
    <div class="tab f14 mt15 clearfix">
        <ul>
            <li ng-repeat="tab in approvalTabs" ng-class="{'tab-on':currentState == tab}"
                ng-click="setApprovalState(tab)">
                <a href="javascript:;">{{tab.name}}</a>
            </li>
        </ul>
        <div class="tab-bottom-line"></div>
    </div>
    <div class="search mt15 clearfix ">
        <div style="width:96px" class="fl">
            <div ui-combobox data="searchFields" text-field="name" value-field="value"
                 ng-model="filter.search_field"></div>
        </div>

        <input type="text" class="input-text fl" style="width:348px" ng-enter="getList(0)" ng-model="filter.search_text">
        <button class="fl btn  permission p-50030601-00-block" ng-click="getList(0)">搜索</button>
    </div>

    <div class="checkbox-wrap mt20 clearfix ">
        <span class="broker-text">经纪人身份：</span>

        <div class="broker-list">
            <a href="javascript: void(0);" ng-repeat="item in capacities"
               ng-click="setCapacitySelected($event,item)" ng-class="{selected:item === curCapacity}">{{item.text}}</a>
        </div>
    </div>
    <div ng-show="capacityItems && capacityItems.length>0">
        <div class="tips-wrap">
            <i class="tips-arrow" style="margin-left: 296px;"></i>

            <div class="tips-con clearfix">
                <div style="display:block">
                    <div class="fl tips-list clearfix">
                        <label class="checkbox ">
                            <input type="checkbox" ng-model="data.agencySelectedAll" ng-change="changeAgencyAll()">
                            <span>全部</span>
                        </label>
                        <label class="checkbox" ng-repeat="item in capacityItems">
                            <input type="checkbox" ng-model="item.selected" ng-change="changeAgency(item)">
                            <span>{{item.text}}</span>
                        </label>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="mt10 border-dashed-bottom" style="display:block">
        <span class="fl">城市：</span>

        <div class="tips-list clearfix">
            <label class="checkbox" ng-repeat="item in cities">
                <input type="checkbox" ng-model="item.selected" ng-change="changeCitySelected(item)">
                <span>{{item.text}}</span>
            </label>
        </div>
    </div>
    <div class="mt10 border-dashed-bottom" ng-if="currentState.audited" style="display:block">
        <span class="fl">审核状态：</span>

        <div class="tips-list clearfix">
            <label class="checkbox" ng-repeat="item in approvelStatus">
                <input type="checkbox" ng-model="item.selected" ng-change="setFilterStatus(item)">
                <span>{{item.text}}</span>
            </label>
        </div>
    </div>
    <div class="mt10 border-dashed-bottom" ng-if="currentState.audited" style="display:block">
        <span class="fl">禁用状态：</span>

        <div class="tips-list clearfix">
            <label class="checkbox" ng-repeat="item in disableFilters">
                <input type="checkbox" ng-model="item.selected" ng-change="setDisableFilters(item)">
                <span>{{item.text}}</span>
            </label>
        </div>
    </div>
    <div class="mt20 clearfix ">
        <span class="fl lh30">注册时间：</span>

        <input type="text" class="input-text input-data fl ng-pristine ng-valid ng-touched" readonly=""
               id="start_date" max-date="#F{$dp.$D(\'end_date'\)}"
               ui-date="" format="yyyy-MM-dd" ng-model="filter.begin_reg_date">
        <span class="fl lh30">&nbsp;&nbsp;-&nbsp;&nbsp;</span>
        <input type="text" class="input-text input-data fl ng-pristine ng-untouched ng-valid"
               id="end_date" min-date="#F{$dp.$D(\'start_date'\)}"
               readonly="" ui-date="" format="yyyy-MM-dd" ng-model="filter.end_reg_date">

        <a href="javascript: void(0)" class="btn fl mlr5 permission p-50030601-00-block" ng-click="getList(1)">查询</a>
        <a href="javascript: void(0)" class="btn btn-gray fl" ng-click="clearFilter()">撤销筛选</a>
    </div>

    <div class="table-header mt20 clearfix ">
        <span class="fl lh30 f14">经纪人列表</span>

        <div class="fr btn-group">
            <a href="javascript: void(0)" class="btn permission p-50030601-01-block"
               ui-dialog="提示"
               ui-dialog-cache="false"
               ui-dialog-before-show="onShowBatchTips(item,$dialog,$dialogScope)"
               ui-dialog-ok="setSelectedBrokersStatus(1)"
               ui-dialog-template="<div><p>确认审核通过所选经纪人吗？</p></div>">批量通过</a>
            <a href="javascript: void(0)" class="btn permission p-50030601-01-block"
               ui-dialog="提示"
               ui-dialog-cache="false"
               ui-dialog-before-show="onShowBatchTips(item,$dialog,$dialogScope)"
               ui-dialog-ok="setSelectedBrokersStatus(0)"
               ui-dialog-template="<div><p>确认审核不通过所选经纪人吗？</p></div>">批量不通过</a>
            <a href="javascript: void(0)" class="btn btn-yellow permission p-50030601-98-block"
               ui-dialog="修改身份信息"
               ui-dialog-cache="false"
               ui-cancel-value="关闭"
               ui-dialog-before-show="onShowModifyInfo(item,$dialog,$dialogScope)"
               ui-dialog-url="inc/dialog/modify_info.html">修改身份信息</a>
            <a href="javascript: void(0)" class="btn btn-yellow permission p-50030601-99-block" ng-click="exportData()">导出</a>
        </div>
    </div>
    <div id="grid" class="table-wrap mt10 ">
        <table width="100%">
            <thead>
            <tr>
                <th >
                    <label class="checkbox">
                        <input type="checkbox" ng-model="data.selectedAllBrokers"
                               ng-change="changeSelectedAllBrokers()">
                        <span>序号</span>
                    </label>
                </th>
                <th width="150" >注册时间</th>
                <th width="100" >经纪人信息</th>
                <th width="150" >证件号码</th>
                <th width="100" >身份信息</th>
                <th width="100" >城市</th>
                <th width="70" >审核状态</th>
                <th width="70" ng-if="currentState.audited" >禁用状态</th>
                <th width="250" style="text-align:center;">操作</th>
            </tr>
            </thead>
            <tbody>
            <tr ng-repeat="item in list">
                <td height="80">
                    <label class="checkbox">
                        <input type="checkbox" ng-model="item.selected"><span>{{filter.pageIndex*filter.pageSize+$index+1}}</span>
                    </label>
                </td>
                <td><p>{{item.reg_date}}</p></td>
                <td>
                    <p>{{item.broker_name}}（{{item.gender}}）</p>
                    <p>{{item.mobile_tel}}</p>
                </td>
                <td>
                    <p>{{item.cre_no}}</p>
                </td>
                <td>
                    <p>{{item.capacity_des_info}}</p>
                    <p ng-if="item.belongs_company_info">所属公司:{{item.belongs_company_info}}</p>
                </td>
                <td>
                    <p>{{item.city_name}}</p>
                </td>
                <td>
                    <p>{{item.status_info}}</p>
                </td>
                <td  ng-if="currentState.audited" >
                    <p>{{item.isdisabled?"已禁用":"未禁用"}}</p>
                </td>
                <td>
                    <div classs="text-center">
                        <a href="javascript: void(0)" class="c-orange mr5 permission p-50030601-00-inline"
                           ui-dialog="查看经纪人详情"
                           ui-dialog-cache="false"
                           ui-dialog-show="onShowBrokerInfo(item,$dialog,$dialogScope)"
                           ui-dialog-url="inc/dialog/broker_view.html">查看</a>

                        <a href="javascript: void(0)" class="c-orange mr5 permission p-50030601-05-inline"
                           ui-dialog="编辑经纪人身份"
                           ui-dialog-cache="false"
                           ui-dialog-show="onShowEditBrokerInfo(item,$dialog,$dialogScope)"
                           ui-dialog-ok="saveBrokerInfo($data,$dialog,$dialogScope)"
                           ui-dialog-url="inc/dialog/broker_edit.html">编辑</a>


                        <a href="javascript: void(0)" ng-if="item.status!=1" class="c-orange mr5 permission p-50030601-01-inline"
                           ui-dialog="提示"
                           ui-dialog-cache="false"
                           ui-dialog-ok="setStatus(item,1)"
                           ui-dialog-template="<div><p>确认审核通过该经纪人吗？</p></div>">审核通过</a>
                        <a href="javascript: void(0)" ng-if="item.status!=2" class="c-orange mr5 permission p-50030601-01-inline"
                           ui-dialog="提示"
                           ui-dialog-cache="false"
                           ui-dialog-ok="setStatus(item,2)"
                           ui-dialog-template="<div><p>确认审核不通过该经纪人吗？</p></div>">审核不通过</a>
                        <a href="javascript: void(0)" ng-if="currentState.audited" class="c-orange mr5 permission p-50030601-20-inline"
                           ui-dialog="重设密码"
                           ui-dialog-cache="false"
                           ui-dialog-show="onShowChangePwd(item,$dialog,$dialogScope)"
                           ui-dialog-ok="changePwd($data,$dialog,$dialogScope)"
                           ui-dialog-url="inc/dialog/broker_change_pwd.html">重设密码</a>

                        <span class="ico-more permission p-50030601-03 p-50030601-07" ng-class="{'p-50030601-02':currentState.audited&&!item.isdisabled}">
                        <a href="javascript:;" class="">
                            <i class="icon-op icon-op-more" style="margin-right:20px;"></i>
                        </a>

                        <div class="top-userinfo-menu">
                            <div class="top-userinfo-menu-list text-center">
                                <a href="javascript:;" class="permission p-50030601-02-block" ng-if="currentState.audited&&!item.isdisabled" ng-click="handleBroker(item,'disable')">禁用</a>
                                <a href="javascript:;" class="permission p-50030601-02-block" ng-if="currentState.audited&&item.isdisabled"
                                   ng-click="handleBroker(item,'enable')">启用</a>
                                <a href="javascript:;" class="permission p-50030601-07-block" ng-if="!item.can_invite_broker" ng-click="setInvite(item,true)">启用邀请经纪人</a>
                                <a href="javascript:;" class="permission p-50030601-07-block" ng-if="item.can_invite_broker" ng-click="setInvite(item,false)">禁用邀请经纪人</a>
                            </div>
                            <i class="top-userinfo-menu-arrow"></i>
                        </div>
                        </span>
                    </div>
                </td>
            </tr>
            </tbody>
        </table>

        <div class="no-data" ng-if="!loading && (!list || list.length==0)"><span>暂无数据</span></div>
    </div>
    <div ui-pagination page-index="pageIndex" page-size="filter.pageSize" total="total"
         changed="getDataPage($pageIndex)"></div>
</div>